using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Content;

namespace TimeWar
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class Dalek : TimeWarSceneItem
    {
        protected Game gameObj = null;

        public Dalek(Game game)
            : base(game)
        {
            // TODO: Construct any child components here
            gameObj = game;
            object3D = new ThreeDimensionalObject();
            object3D.ModelLocation = "Content\\Models\\Dalek";
            object3D.Initialize();
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void  Update(TimeSpan time, TimeSpan elapsedTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                gameObj.Exit();
            }

            //modelRotation += (float)elapsedTime.TotalMilliseconds * MathHelper.ToRadians(0.1f);
            //modelRotation = 270;
            if (GamePad.GetState(PlayerIndex.One).DPad.Left == ButtonState.Pressed)
            {
                object3D.RotateLeft(1);
            }
            else if (GamePad.GetState(PlayerIndex.One).DPad.Right == ButtonState.Pressed)
            {
                object3D.RotateRight(1);
            }

        }

        public void Draw()
        {
            object3D.Draw();
        }



    }
}